package com.briup.estore.common.exception;


import com.briup.estore.common.constant.ExceptionMsgEnum;

/**
 * @Author briup-adam
 * @Date 2023/8/1 上午10:29
 * @Description 自定义异常
 **/

public class EstoreException  extends  RuntimeException {
    private  int code;
    private String  msg;
    /*
     * 获取状态码
     */
    public int getCode() {
        return code;
    }

    /*
     * 获取提示信息
     */
    public String getMsg() {
        return msg;
    }

    /*
     * 构造器，将枚举状态码和提示信息作为参数传入
     */
    public EstoreException(ExceptionMsgEnum codeMsgEnum) {
        super(codeMsgEnum.getMsg());
        this.code = codeMsgEnum.getCode();
        this.msg = codeMsgEnum.getMsg();
    }

    public EstoreException(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }
}
